package org.stone.project.tx.sysEnum;

import cn.hutool.core.util.ObjectUtil;

/**
 * 消息接受人类别
 */
public enum ReceiveType {
    USER(1,"用户"),   //不需要异步
    ROLE(2,"角色"),   //需要异步
    GROUP(3,"群组"),  //需要异步
    ALL(4,"全体用户"), //需要异步
    ;
    public Integer code;

    public String describ;

    ReceiveType(Integer code, String describ) {
        this.code = code;
        this.describ = describ;
    }

    public static ReceiveType getInstance(Integer code){
        if (ObjectUtil.isNull(code)){
            return null;
        }
        ReceiveType[] values = values();
        for (ReceiveType value : values) {
            if (value.code.equals(code))
                return value;
        }
        return null;
    }
}
